package com.xq.demo;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.xq.vo.DemoVo;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class Test8 {

    public static void main(String[] args) {
       /* String a=new String("a");
        String b=new String("a");
        System.out.println(a==b);*/
      /* Set<String> set = new HashSet<>();
        set.add("a");
        set.add("a");
        set.add("a");
        set.add("b");
        set.add("b");
        System.out.println(JSON.toJSONString(set));*/

        /*Set<DemoVo> set = new HashSet<>();

        DemoVo demoVo1 = new DemoVo();
        demoVo1.setId(1);
        demoVo1.setName("大宝");

        DemoVo demoVo2 = new DemoVo();
        demoVo2.equals()
        demoVo2.setId(2);
        demoVo2.setName("二宝");

        DemoVo demoVo3 = new DemoVo();
        demoVo3.setId(1);
        demoVo3.setName("大宝");

        set.add(demoVo1);
        set.add(demoVo2);
        set.add(demoVo3);

        System.out.println(JSON.toJSONString(set));*/



       /* String str ="abc";
        String str2 =new String("abc");
        String str3 ="abc";
        String str4 ="a"+"b"+"c";
        String c="c";
        String str5 ="a"+"b"+c;
        System.out.println(str3==(str5));*/

        List<DemoVo> list = Lists.newArrayList();
        DemoVo demoVo1 = new DemoVo();
        demoVo1.setId(1);
        demoVo1.setName("大宝");

        DemoVo demoVo2 = new DemoVo();
        demoVo2.setId(2);
        demoVo2.setName("二宝");

        DemoVo demoVo3 = new DemoVo();
        demoVo3.setId(1);
        demoVo3.setName("大宝");
        list.add(demoVo1);
        list.add(demoVo2);
        list.add(demoVo3);

        List<DemoVo> list2 = list.stream().distinct().collect(Collectors.toList());
        System.out.println(JSON.toJSONString(list2));
    }
}
